using System.Diagnostics.CodeAnalysis;
using Digitalmes.Domain.SeedWork;
using SqlSugar;

namespace Digitalmes.Infrastructure.IntegrationTests.Models;


/// <summary>
/// 订单
/// </summary>
/// <remarks>
/// MySQL: 
/// <code>
/// DROP TABLE IF EXISTS `my_order_item`;
/// CREATE TABLE `my_order_item` (
///   `Id` 					    bigint(20) NOT NULL COMMENT 'Id',
///   `OrderId` 			  bigint(20) NOT NULL COMMENT '订单Id',
///   `Sn`			        varchar(64) NOT NULL COMMENT 'SN',
///   `ProductId` 			bigint(20) NOT NULL COMMENT '产品Id',
///   PRIMARY KEY(`Id`)
/// ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT = DYNAMIC COMMENT='订单表';
/// </code>
/// </remarks>
[SugarTable("my_order_item")]
public sealed class MyOrderItem : EntityBase
{
    public long OrderId { get; set; }

    public string? Sn { get; set; }

    public long ProductId { get; set; }

    [NotNull]
    [Navigate(NavigateType.OneToOne, nameof(ProductId))]
    public MyProduct? Product { get; set; }
}
